package com.mia.craftstudio.utils;

import com.mia.craftstudio.minecraft.forge.CSLibMod;
import java.util.HashMap;
import java.util.Map;

public class Timer {
   private Map timingsStart = new HashMap();
   private Map timingsStop = new HashMap();
   private Map accumulators = new HashMap();

   public void start(String s) {
      this.timingsStart.put(s, System.currentTimeMillis());
   }

   public void stop(String s) {
      this.timingsStop.put(s, System.currentTimeMillis());
   }

   public long get(String s) {
      return (Long)this.timingsStop.get(s) - (Long)this.timingsStart.get(s);
   }

   public long getAcc(String s) {
      return (Long)this.accumulators.get(s);
   }

   public void add(String target, String value) {
      this.accumulators.put(target, (Long)this.accumulators.get(target) + this.get(value));
   }

   public void reset(String s) {
      this.accumulators.put(s, 0L);
   }

   public void print(String s) {
      CSLibMod.log.info(String.format("%s : %s ms", s, this.get(s)));
   }

   public void printAcc(String s) {
      CSLibMod.log.info(String.format("%s : %s ms", s, this.getAcc(s)));
   }
}
